﻿using Dapper.Database;
using Dapper.Database.Adapters;
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using Dapper;
using Dapper.Database.Extensions;
using System.Data.Common;
using System.Linq.Expressions;
namespace QuickFramework.Orm
{
    public partial interface IRepository : Shared.Contracts.IDependency
    {

        /// <summary>
        /// 仓储内部使用的工作单元
        /// </summary>
        IUnitOfWork UnitOfWork { get; }

        #region 自定义扩展方法
        /// <summary>
        /// 更新数据,只更新变更过值的属性
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entityToUpdate"></param>
        /// <param name="unitOfWork"></param>
        /// <param name="commandTimeout"></param>
        /// <returns></returns>
        bool Update4Setting<T>(T entityToUpdate, IUnitOfWork unitOfWork = null, int? commandTimeout = null)
            where T : Shared.Contracts.EntityBase;
        /// <summary>
        /// 更新数据,只更新变更过值的属性
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entityToUpdate"></param>
        /// <param name="unitOfWork"></param>
        /// <param name="commandTimeout"></param>
        /// <returns></returns>
        Task<bool> Update4SettingAsync<T>(T entityToUpdate, IUnitOfWork unitOfWork = null, int? commandTimeout = null)
            where T : Shared.Contracts.EntityBase;

        #endregion
    }
}
